{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.animation as animation\n",
    "from scipy.integrate import solve_ivp\n",
    "from pylab import mpl\n",
    "# 设置显示中文字体\n",
    "mpl.rcParams[\"font.sans-serif\"] = [\"SimHei\"]\n",
    "# 设置正常显示符号\n",
    "mpl.rcParams[\"axes.unicode_minus\"] = False\n",
    "\n",
    "\n",
    "def diff_equation(t, ylist):\n",
    "    x, y, p, q = ylist\n",
    "    return np.array([3*30*(p-x)/((p-x)**2+(q-y)**2)**(0.5), 3*30*(q-y)/((p-x)**2+(q-y)**2)**(0.5), 15*np.cos(np.pi/4), 15*np.sin(np.pi/4)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAnjklEQVR4nO3df3BV5f3g8feTBNLATb4mARKBQIiFLAnfvRqi+YZmCdbS7XZ2SnG7lo7Y6lZptwy0dabdtrbSUrV22zJjtda6Q63V+l3EcbXVlu3XGRJMTaOYbSygJB1ACOWH8iu5JFxI8uwfSW4Bcy/3uSSe5+bzec1kJMk9J887h/gh99x7rrHWopRSSvkmI+gFKKWUUiPRAaWUUspLOqCUUkp5SQeUUkopL+mAUkop5SUdUEoppbykA0oppZSXkhpQxpgiY8zL572/0RjTbIz59tgtTSmllGSXHFDGmHzgcWDy0Ps3ApnW2lqgzBgzd2yXqJRSSqKsJG7TD3waeH7o/SXA00N//iNQB3Scv4ExZhWwCmDSpEkLZ86cCUB2djaZmZn09PQMfvGsLHJycuju7h7ejlAoRCQSYfgKF5Mn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29GzHG7L7UDhfCwhE/8fbbvG7M6ymuM91MAd4NehEB0XZ5pHaD7PbyZG+Y6oCaDBwc+vNxoOr8T1prHwUeTXHfGGO2J/tErvFEajdou8R2qd2g7cneNtVzUBEgZ+jPocvYj1JKKTWiVAfL6wzerQcQBvaNymqUUkqpIanexfcc8LIxZjrwn4B/GbUVDUr57sE0J7UbtF0iqd2g7UlJ+WKxxph8YCmwzVp7OKWdKKWUUnGM+dXMlVJKqVTogxuUUkqNGWNMgTFmqTFmiuu23g2oUb9CRRowxmQZY/YbYxqG3v456DW9H4wxRcaYl897X8yxP79dyvE3xvyTMeYPxpg/GmP+jzFmooRjHqd73B9viJ0KegG4DthqjJnqcsy9GlBjcoWK9PDvgX+11i4Zevtr0Asaa0N/cR9n8Dl1oo79xe3IOf43AxustR8FDgMrkHHML+7+BjKONwz+3b7TWnsv8H+BD+NwzL0aUIx8hQoJ/gX4z8aYV4f+dZHqoyvTST/waaBr6P0lyDn2F7eLOP7W2oettf829O5UYCUCjvkI3X0ION4A1tpGa+2fjTGLGfwt6j/icMx9G1AXX6GiKMC1vJ9eAz5irb0OmAB8POD1jDlrbZe19tR5HxJz7EdoF3X8jTG1QD5wACHHHC7o/jdkHW/D4D/ITgAWh2Pu24CSeoWKN6y1h4b+vB0Yr3d1JCL12IOg42+MKQAeBP4bgo75Rd1ijjeAHbQaeANYhMMx9+0vhNQrVDxhjAkbYzKBTwJtAa8nCFKPPQg5/saYicBm4JvW2rcRcsxH6BZxvAGMMf/DGPPZoXevAO7H4Zj7dt/nc4ztFSp8tR54CjDAb621LwW8niA8h8xjD3KO/+cZvLD0XcaYu4DHgFsEHPOLu7cCTzD+jzcMXjXiaWPM7cAOBn/OtyV7zL17oq5eoUIuPfby6DGXx+WYezeglFJKKfDvHJRSSikF6IBSSinlKR1QSimlvKQDSimllJd0QCmllPLS/wfz6CjD68X4pAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "t = np.linspace(0, 30, 10000)\n",
    "\n",
    "results = solve_ivp(diff_equation, (0., 30.), [0, 0, 20, 0], t_eval=t).y\n",
    "x, y, m, n = [results[i, :] for i in range(4)]\n",
    "# %%处理得到的四种数据，删去距离小的\n",
    "k = np.size(t)\n",
    "d = 0\n",
    "for i in range(0, k):\n",
    "    dd = np.sqrt((x[i]-m[i])**2+(y[i]-n[i])**2)\n",
    "    if dd <= 0.05:\n",
    "        index = np.arange(i, k)\n",
    "        index = index.astype('int64')  # 他奶奶的，这个删除的index用法要求传入的是整数\n",
    "        # 但是他奶奶的np.arrange生成的玩意儿不是整数，搞了我一晚上，气死我了\n",
    "        t = np.delete(t, index)\n",
    "        x = np.delete(x, index)\n",
    "        y = np.delete(y, index)\n",
    "        m = np.delete(m, index)\n",
    "        n = np.delete(n, index)\n",
    "        break\n",
    "# %%画出动态图像\n",
    "fig = plt.figure(tight_layout=True)\n",
    "plt.xlim((-1, 30))  # 设置图框的横纵坐标显示范围\n",
    "plt.ylim((0, 10))\n",
    "xx, yy, mm, nn = [[] for i in range(4)]  # 把四个变量的结果取出来分别赋给四个一维数组\n",
    "point_ani1, = plt.plot(xx, yy, \"r-\")  # 导弹飞行轨迹\n",
    "point_ani2, = plt.plot(mm, nn, \"b-\")  # 船航行轨迹\n",
    "point_ani_ball, = plt.plot(xx, yy, \"ro\", linewidth=10)\n",
    "text_pt1 = plt.text(0.5, 9, '', fontsize=13)\n",
    "text_pt2 = plt.text(0.5, 8, '', fontsize=13)\n",
    "\n",
    "\n",
    "def update(num):\n",
    "    xx.append(x[num])\n",
    "    yy.append(y[num])\n",
    "    mm.append(m[num])\n",
    "    nn.append(n[num])\n",
    "    point_ani1.set_data(xx, yy)\n",
    "    point_ani2.set_data(mm, nn)\n",
    "    point_ani_ball.set_data(xx, yy)\n",
    "    text_pt1.set_text(\"x=%.3f, y=%.3f\" % (x[num], y[num]))\n",
    "    text_pt2.set_text(\"m=%.3f, n=%.3f\" % (m[num], n[num]))\n",
    "    return point_ani1, text_pt1, point_ani2, text_pt2,\n",
    "\n",
    "\n",
    "plt.grid(ls=\"--\")\n",
    "ani = animation.FuncAnimation(fig=fig,\n",
    "                              func=update,\n",
    "                              frames=100,\n",
    "                              interval=5,\n",
    "                              blit=True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "导弹飞行 29.172015063253603 单位后击中目标\n",
      "导弹飞行时间为： 21.96219621962196 分钟\n",
      "击中点的坐标为： 22.617040176146965 2.5992944086145293\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAD2CAYAAAAj3nsdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAVUElEQVR4nO3dbawcZ3XA8f/BjkVwaiuIm1R8CBHYrYRNnIKJEilJL62hNM2HKIsKKqQCU6VFqF9iIRUlooVGrVqVqBLCqJGcAmkBhTYxQVWrEKlxLdWIXIs4cfhQoiihijBcSIiVRnk//XB38d713d3Z3dmXmfn/pNXOep+7+3g8nnOf55xnJjITSZI28rp5d0CStLgMEpKkvgwSkqS+DBKSpL4MEpKkvjbP40vf9KY35cUXXzyPr5akyjp+/PjPMnNplt85lyBx8cUXs7KyMo+vlqTKiognZ/2dTjdJkvoySEiS+jJISJL6MkhIkvoySEiS+jJISJL6MkhI0hxlJhHBiy++WKh9RLwlIjIizi36HRHxJxHxH+P0zyAhSTPSasEFF6w9d0QEW7ZsYcuWLUU/5pX286sjfPULQLEo1MMgIUkzsmsXrK6+zNve9gzd9/KJCCLil6+ff/55Xn755X4f80rPc1G/HRGPdT2eioi/G/ZDc1lxLUlNdOAA3H//43zjG7/D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/3N5eARw6r/EYWa/Rx0lEvBH4ArAfj41SLPpO897ZZ9wZEXsiYhNwHXBizv1ZFB4j6zX2OImILcA3gU9n5pN4bJRi0ecrD+O9szs+B3wNCODezLx/zv1ZFIfxGOnW5OPk48A7gZsj4mbgH4EbPDYms/ArrtvVG+8F/iszT827P1o8HiPqx2NjcgsfJCRJ87PoOQlJ0hwZJCRJfRkkJEl9GSQkSX0ZJCRJff0/DEuPFsdiauAAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from turtle import color\n",
    "\n",
    "\n",
    "kk = np.size(t)\n",
    "\n",
    "for i in range(0, kk):\n",
    "    dd = np.abs(x[i]-y[i]-20)/np.sqrt(2)\n",
    "    plt.scatter(x[i], y[i], 3,color='r',marker='v')\n",
    "    plt.scatter(m[i], n[i], 3,color='b',marker='v')\n",
    "    if dd < 0.05:\n",
    "        for l in range(1, kk):\n",
    "            d = np.sqrt((x[l]-x[l-1])**2+(y[l]-y[l-1])**2)+d\n",
    "        if d <= 50:\n",
    "            print('导弹飞行', d, '单位后击中目标')\n",
    "            print('导弹飞行时间为：', 60*(t[kk-1]), '分钟')\n",
    "            print('击中点的坐标为：', x[i], y[i])\n",
    "            plt.text(x[i], y[i], '击中点', fontsize=13)\n",
    "            # plt.plot(x[i], y[i], 'g*')\n",
    "\n",
    "        break\n",
    "\n",
    "if d > 50 or dd >= 0.05:\n",
    "    print('导弹没有击中船')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.12 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "eee0b994916456e401bb2059c96fd61a917a7b7611ddaa8527d0e63171185627"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
